package suites.integration {
	import org.flexunit.asserts.assertTrue;
	import org.splink.library.queue.QEvent;
	import org.splink.resource.ResourceProvider;

	import flash.utils.ByteArray;

	/**
	 * <code>LibraryTest</code> assumes that there is a as3ds.swf within the sample/library folder
	 * which contains the as3ds library
	 * 
	 * @author Max Kugland
	 */
	public class FilesTest extends AbstractIntegrationTest {

		[Test (async,order=1)]
		public function singleFile() : void {
			handleAsync(24000);
			
			var xml : XML = <resourcebundles defaultLocale="de_DE">
								<resourcebundle locale="de_DE" >
									<files path="../sample/files/">
										<file filesize="67" src="test.xml" id="test-text" fileType="text" />
										<file filesize="0" src="test.swf" id="test-binary" fileType="binary" />
									</files>
								</resourcebundle>
							</resourcebundles>;
							
			createProcessor(xml, function(e : QEvent) : void {
				var xml : * = ResourceProvider.instance().getFileById("test-text");
				assertTrue(new XML(xml) is XML);
				var byteArray : * = ResourceProvider.instance().getFileById("test-binary");
				assertTrue((byteArray is ByteArray));
			}).start();
		}
	}
}
